<!doctype html>
<html>
<head>
<include file="public:headtop" />
    <link href="/static/css/general.css" rel="stylesheet">
<link href="/static/css/center.css" rel="stylesheet">
</head>

<body>
	<include file="public:headmini1" />
	  <div class="order-box">
    	<div class="order ope">我的订单</div>
          <table class="media">
              <volist name="item_orders" id="vo">
                  <tr>
                      <td>
                          <a href="{:U('Item/order', array('id' => $vo['id']))}">
                              <h3 class="media-title">
                                  <span class="float-right media-date">{: date('y-m-d H:i', $vo['add_time']);}</span>
                                  <span class="text-red">{$vo.sn}</span>
                              </h3>
                              <div class="media-text">
                                  <span class="media-text-item">数量：{$vo.num}</span>
                                  <span class="media-text-item">金额：￥{$vo.price}</span>
                                  <span class="media-text-item">状态：<?php echo $status_arr[$vo['status']]; ?></span>
                              </div>
                          </a> <if condition="$vo['status'] eq 0 ">  <span class="media-text"><a onclick="delOrder({$vo['id']})"> 删除订单</a></span> </if>
                      </td>
                  </tr>
              </volist>
          </table>
    </div>
</body>
<script>

    function delOrder(id){
        if (!confirm('你确定要删除此订单吗?')) {
          return false;
        }
        var url = "{:U('Order/del')}"+"&oid="+id;
        $.getJSON(url,function(data){
            if (data['code']==1) {
                // alert(data['msg']);
            }

            alert(data['msg']);
            window.location.reload();
            
        });
    }

$(function(){
	$('.showgoodsinfo').click(function(){
		var id = parseInt($(this).attr('data'));
		var gid = parseInt($(this).attr('goods'));
		if(id>0 && typeof(id)=='number' && gid>0 && typeof(gid)=='number'){
			location.href="{:U('Item/jiesuan')}&id="+gid+"&od="+id+"&f=ord";
		}else{
			alert('请确认提供的数据的准确性！');
		}
	})
	$('.showorder').click(function(){
		var id = parseInt($(this).attr('data'));
		if(id>0 && typeof(id)=='number'){
			location.href="{:U('Item/order')}&id="+id;
		}else{
			alert('请确认提供的数据的准确性！');
		}
	})
})
</script>
</html>